package com.pt25.service.sys.domain.config.ddo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.pt25.base.util.JsonUtil;
import com.pt25.base.util.PageUtil;
import com.pt25.service.sys.repository.mysql.po.ConfigDataPo;
import lombok.*;

import java.time.LocalDateTime;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(
    callSuper = true
)
public class ConfigData extends PageUtil.PageBase {
  @JsonFormat(
      shape = JsonFormat.Shape.STRING
  )
  private Long id;

  @JsonFormat(shape = JsonFormat.Shape.STRING)
  private Long configTypeId;

  private String dataType;

  private String dataKey;

  private String dataName;

  private String dataDescription;

  private String valueType;

  private LocalDateTime createTime;

  private LocalDateTime updateTime;

  private Integer delFlag;

  public ConfigDataPo toConfigDataPo() {
    return JsonUtil.toBean(JsonUtil.toJson(this), ConfigDataPo.class);
  }

  public static ConfigData toConfigData(ConfigDataPo configDataPo) {
    return JsonUtil.toBean(JsonUtil.toJson(configDataPo), ConfigData.class);
  }
}
